<template>
  <div style="background-color: #eeeeee;height:932px">
  <van-nav-bar
      title="实名认证"
      left-text="返回"
      left-arrow
      @click-left="onClickLeft"
  />
  <br>
  <van-cell-group inset >
    <!-- 输入任意文本 -->
    <van-field v-model="cardName" type="cardName" label="姓名：" />
    <!-- 输入手机号，调起手机号键盘 -->
    <van-field v-model="cardId" type="cardId" label="身份证号：" />
    <p style="font-size: 13px" align="center">港澳用户实名认证<router-link to="/GAauthentication">点击这里</router-link></p>
  </van-cell-group>
    <div style="margin: 16px;">
      <van-button round block type="primary" @click="Addsubmit()">
        提交
      </van-button>
    </div>
  </div>

</template>
<script setup>
import { ref } from 'vue';
import request from "@/request/request.js";
import { showSuccessToast, showFailToast } from 'vant';
const route = useRouter()
const cardName = ref('');
const cardId = ref('');
const onClickLeft = () => {
  // 返回上一页
  route.push('/home')
}

const Addsubmit = () => {
  request({
    url: '/sysuser/realName',
    method: 'post',
    params: {
      cardName: cardName.value,
      cardId: cardId.value
    }
  }).then(res=>{
    if (res.data.code == 200){
      showSuccessToast('认证成功');
      route.replace({name:"Home"})
    }else{
      showFailToast('认证失败');
    }
  })
}
</script>